<?php

namespace IDock\Insurance\ZSIC\Request;

use IDock\Insurance\ZSIC\Request\AllZSICRequest;
use IDock\Insurance\ZSIC\Response\VehicleCheckResponse;
use IDock\Insurance\ZSIC\Response\VehicleModelResponse;
use IDock\Insurance\ZSIC\ZSICEnums;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\VehicleModelVisitor;

/**
 * 车型查询接口
 */
class VehicleCheckRequest extends AllZSICRequest
{
    protected $response = VehicleCheckResponse::class;

    protected $urlTip = '验车';

    public $requestCode = 'getInspect';

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    public function generate(): array
    {
        return [
            'vehicle' => [
                'licenseNo' => $this->visitor->getVehicleVisitor()->licenseNo,
                'ownerName' => $this->visitor->getOwnerVisitor()->name,
                'idType' => ZSICEnums::$certificateTypeCode[$this->visitor->getOwnerVisitor()->certificateTypeCode] ?? '',
                'engineNo' => $this->visitor->getVehicleVisitor()->engineNo,
                'idNumber' => $this->visitor->getOwnerVisitor()->certificateNo,
                'frameNo' => $this->visitor->getVehicleVisitor()->vin,
                'cInspectClaim' => $this->visitor->getExtInfoVisitor()->argc['cInspectClaim'] ?? '',
            ]
        ];
    }

    public function getBusinessNo()
    {
        return $this->visitor->getExtInfoVisitor()->argc['businessNo'] ?? '';
    }
}
